package com.servingcloud.serverb.modules.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.servingcloud.common.model.RestPage;
import com.servingcloud.common.model.RestResult;
import com.servingcloud.servera.api.models.request.UserInfoModifyReq;
import com.servingcloud.servera.api.models.request.UserInfoQueryReq;
import com.servingcloud.servera.api.models.request.UserInfoSaveReq;
import com.servingcloud.servera.api.models.response.UserInfoRes;
import com.servingcloud.servera.api.service.UserInfoService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(value="servera用户信息接口", tags="用户")
@RestController
@RequestMapping("/userInfoApi")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @ApiOperation(httpMethod="POST", value="获取用户列表分页", notes="", response=UserInfoRes.class)
    @RequestMapping("/findUserInfoPage")
    public @ResponseBody RestResult<RestPage<UserInfoRes>> findUserInfoPage(@RequestBody UserInfoQueryReq param){
    	return userInfoService.findUserInfoPage(param);
    }
    @ApiOperation(httpMethod="POST", value="新增用户信息", notes="", response=Long.class)
    @RequestMapping("/saveUserInfo")
    public @ResponseBody RestResult<Long> saveUserInfo(@RequestBody @Validated UserInfoSaveReq param){
    	return userInfoService.saveUserInfo(param);
    }
    @ApiOperation(httpMethod="POST", value="修改用户信息", notes="")
    @RequestMapping("/modifyUserInfo")
    public @ResponseBody RestResult<Object> modifyUserInfo(@RequestBody @Validated UserInfoModifyReq param){
    	return userInfoService.modifyUserInfo(param);
    }
    @ApiOperation(httpMethod="POST", value="删除用户", notes="")
    @RequestMapping("/deleteUserInfo")
    public @ResponseBody RestResult<Object> deleteUserInfo(@RequestBody @Validated UserInfoModifyReq param){
    	return userInfoService.deleteUserInfo(param);
    }
}